package lib.common.use;

import org.apache.http.client.CircularRedirectException;

import android.graphics.Point;
import android.os.Handler;
import android.widget.LinearLayout;

import com.app.BaseActivity;
import com.app.util.Utils_Hardware;
import com.app.view.CircleSurfaceView;
import com.app.view.TimeCountDownView;
import com.app.view.TimeCountDownView.OnListener;
import com.app.view.TimeLineView;

public class DIYViewActivity extends BaseActivity{

	
	
	
	Handler handler = new Handler();
	
	
	@Override
	public int InitLayout() {
		// TODO Auto-generated method stub
		return R.layout.activity_diyview;
	}

	@Override
	public void InitView() {
		// TODO Auto-generated method stub
		
		
		// very nice;
		TimeCountDownView view_TimeCount = (TimeCountDownView)findViewById(R.id.view_TimeCount);
		view_TimeCount.SetOnListener( new OnListener() {
			
			@Override
			public void OnProgress(long millisUntilFinished) {
				// TODO Auto-generated method stub
				System.out.println("TimeCountDownView: "+millisUntilFinished);
				
			}
			
			@Override
			public void OnComplete() {
				// TODO Auto-generated method stub
				System.out.println("TimeCountDownView OnComplete" );
			}
		});
		view_TimeCount.Start("0:0:60"); 
		
		
		
		int[] size = Utils_Hardware.getScreenSize(this);
		
		// 圆形向外扩散
		LinearLayout layout_content = (LinearLayout)findViewById(R.id.layout_content);
		CircleSurfaceView circle = new CircleSurfaceView(this);
		circle.SetPointCenter( new Point(size[0]/2,100) );
		layout_content.addView( circle );
		
		 
	}

	@Override
	public void InitListener() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void InitProcess() { 
		// TODO Auto-generated method stub
		
		final TimeLineView view_timeline = (TimeLineView)this.findViewById(R.id.view_timeline);
		 handler.postDelayed(new Runnable(){

			@Override
			public void run() {
				// TODO Auto-generated method stub
	
				LinearLayout.LayoutParams params = (LinearLayout.LayoutParams)view_timeline.getLayoutParams();
				System.out.println(params.leftMargin);
				 
				int width = view_timeline.getMeasuredWidth();
				System.out.println(width);
				
			}
			 
		 }, 2000);
		
	}
	

}
